home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / util / cli / sploinerwos.lha / source.lha / usage.c < prev    next >
C/C++ Source or Header  |  1995-11-30  |  10KB  |  264 lines

  1. #include "common.h"
  2.  
  3. void usage_example(void)
  4. {
  5. printf("An example of sploiner usage\n");
  6. printf("============================\n");
  7. printf("\n");
  8. printf("Let's say i have a 4000000 bytes file i want to take home on HD-disks. \n");
  9. printf("\n");
  10. printf("  # ls -l\n");
  11. printf("  total 3907\n");
  12. printf("  -rw-rw-rw-   1 ric      users     4000000 May 29 00:16 file.lha\n");
  13. printf("\n");
  14. printf("First i split it in disksized chunks:\n");
  15. printf("\n");
  16. printf("  # sploiner split file.lha -s 1440000 -o chunk\n");
  17. printf("\n");
  18. printf("  Filesize: 1440000 bytes\n");
  19. printf("  Done! Writing Shadowfile.\n");
  20. printf("  Output: 4 files\n");
  21. printf("\n");
  22. printf("Providing the computer has 1440000 bytes of contigous free \n");
  23. printf("memory, and 5.5MB free harddisk space, i now have 4 ekstra files.\n");
  24. printf("\n");
  25. printf("# ls -l\n");
  26. printf("total 9222\n");
  27. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:20 chunk.000\n");
  28. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:21 chunk.001\n");
  29. printf("-rw-rw-rw-   1 ric      users     1120000 May 29 00:21 chunk.002\n");
  30. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:21 chunk.SHA\n");
  31. printf("-rw-rw-rw-   1 ric      users     4000000 May 29 00:16 file.lha\n");
  32. printf("\n");
  33. printf("chunk.000, chunk.001 and chunk.002 is the data from \n");
  34. printf("file.lha. chunk.SHA is the file containing data for \n");
  35. printf("error recovery.\n");
  36. printf("\n");
  37. printf("I now put chunk.000, chunk.001, chunk.002 and chunk.SHA onto four\n");
  38. printf("disks and carry them home. Let's say that the disk containing \n");
  39. printf("chunk.001 accidentially gets run over by a bus. I then have the \n");
  40. printf("following files.\n");
  41. printf("\n");
  42. printf("# ls -l\n");
  43. printf("total 3908\n");
  44. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:20 chunk.000\n");
  45. printf("-rw-rw-rw-   1 ric      users     1120000 May 29 00:21 chunk.002\n");
  46. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:21 chunk.SHA\n");
  47. printf("\n");
  48. printf("Which is enough to recreate chunk.001:\n");
  49. printf("\n");
  50. printf("# sploiner repair chunk.000 chunk.002 chunk.SHA as chunk.001\n");
  51. printf("# ls -l\n");
  52. printf("total 5315\n");
  53. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:20 chunk.000\n");
  54. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:22 chunk.001\n");
  55. printf("-rw-rw-rw-   1 ric      users     1120000 May 29 00:21 chunk.002\n");
  56. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:21 chunk.SHA\n");
  57. printf("\n");
  58. printf("And i can now join chunk.000, chunk.001 and chunk.002 to \n");
  59. printf("recreate file.lha.\n");
  60. printf("\n");
  61. printf("# sploiner join chunk as file.lha\n");
  62. printf("\n");
  63. printf("# ls -l\n");
  64. printf("total 9222\n");
  65. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:20 chunk.000\n");
  66. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:22 chunk.001\n");
  67. printf("-rw-rw-rw-   1 ric      users     1120000 May 29 00:21 chunk.002\n");
  68. printf("-rw-rw-rw-   1 ric      users     1440000 May 29 00:21 chunk.SHA\n");
  69. printf("-rw-rw-rw-   1 ric      users     4000000 May 29 00:23 file.lha\n");
  70. printf("\n");
  71. printf("There are a few considerations about the program. \n");
  72. printf("\n");
  73. printf("- If you never have diskerrors, the shodowfile (chunk.SHA) is \n");
  74. printf("  useless, and it's only a waste of time and space to bring\n");
  75. printf("  it along. \n");
  76. printf("- If you lose more than one file, then it is impossible to \n");
  77. printf("  recreate any of the lost files.\n");
  78. printf("- The recreation of a lost file always generates a file with\n");
  79. printf("  the same size as the shadowfile, which in the above example\n");
  80. printf("  means that if i recreate chunk.002 it will become 1440000 bytes,\n");
  81. printf("  and file.lha will become 4320000 bytes. The excess space will\n");
  82. printf("  consist of zero's, and i not a problem for e.g. lha packed files.\n");
  83. printf("\n");
  84.  
  85. exit(1);
  86. }
  87.  
  88. void usage_repair(void)
  89. {
  90. printf("\n");
  91. printf("Sploiner                 USER COMMANDS                   Sploiner\n");
  92. printf("\n");
  93. printf("\n");
  94. printf("\n");
  95. printf("NAME\n");
  96. printf("     Sploiner - Repair. \n");
  97. printf("\n");
  98. printf("SYNOPSIS\n");
  99. printf("     Sploiner repair file_1 file_2 ... file_n as damaged_file\n");
  100. printf("\n");
  101. printf("DISCLAIMER\n");
  102. printf("     I take NO responsibilities for this program.\n");
  103. printf("     Any use is on your own risk.\n");
  104. printf("\n");
  105. printf("DESCRIPTION\n");
  106. printf("     Rebuilds a lost file by combining the rest of the files with\n");
  107. printf("     the shadowfile and adding a bit of black magic.\n");
  108. printf("     The order of files is unimportant.\n");
  109. printf("     ex. %s repair Part.000 Part.002 Part.003 Part.SHA as Part.001\n",prgname);
  110. printf("     After rebuilding, you can join the files as normal.\n");
  111. printf("     Only one file can be recovered.\n");
  112. printf("\n");
  113. printf("     About the magic: Well, actually it's only the principle from \n");
  114. printf("     parity bit. The shadowfile is made by XOR'ing all parts \n");
  115. printf("     together. A lost file is recovered by XOR'ing the rest of\n");
  116. printf("     the files and the shadowfile.\n");
  117. printf("\n");
  118. printf("BUGS\n");
  119. printf("     If you are repairing the last part, it will become the same size\n");
  120. printf("     as the other files. The extra space consists of zero's, and is\n");
  121. printf("     no problem to eg. lha.\n");
  122. printf("     I'm currently working on a fix for it. \n");
  123. printf("\n");
  124. printf("     Please reports other bugs to: ric@daimi.aau.dk (Internet).\n");
  125. printf("\n");
  126.  
  127. exit(1);
  128. }
  129.  
  130. void usage_join(void)
  131. {
  132. printf("\n");
  133. printf("Sploiner                 USER COMMANDS                   Sploiner\n");
  134. printf("\n");
  135. printf("\n");
  136. printf("NAME\n");
  137. printf("     Sploiner - Join \n");
  138. printf("\n");
  139. printf("SYNOPSIS\n");
  140. printf("     Sploiner join <basename> as <joined_file>\n");
  141. printf("\n");
  142. printf("DISCLAIMER\n");
  143. printf("     I take NO responsibilities for this program.\n");
  144. printf("     Any use is on your own risk.\n");
  145. printf("\n");
  146. printf("DESCRIPTION\n");
  147. printf("     Join <basename>.000 - <basename>.nnn as one file. \n");
  148. printf("     ex. if you have f.ex Part.000, Part.001 and Part.002 use:\n");
  149. printf("     Sploiner join Part as file.lha\n");
  150. printf("\n");
  151. printf("BUGS\n");
  152. printf("     Please reports bugs to: ric@daimi.aau.dk (Internet).\n");
  153. printf("\n");
  154.  
  155. exit(1);
  156. }
  157.  
  158. void usage_split(void)
  159. {
  160. printf("\n");
  161. printf("Sploiner                 USER COMMANDS                   Sploiner\n");
  162. printf("\n");
  163. printf("\n");
  164. printf("\n");
  165. printf("NAME\n");
  166. printf("     Sploiner - Split \n");
  167. printf("\n");
  168. printf("SYNOPSIS\n");
  169. printf("     Sploiner split  <InputFile> [-n] [-s Filesize] [-o Outputname] \n");
  170. printf("\n");
  171. printf("DISCLAIMER\n");
  172. printf("     I take NO responsibilities for this program.\n");
  173. printf("     Any use is on your own risk.\n");
  174. printf("\n");
  175. printf("DESCRIPTION\n");
  176. printf("     This program splits a large file up in smaller chunks, and\n");
  177. printf("     optionally produces a 'shadowfile', which in case of a lost\n");
  178. printf("     chunk, can rebuild the lost chunk when combined with the rest\n");
  179. printf("     of the chunks. \n");
  180. printf("\n");
  181. printf("OPTIONS\n");
  182. printf("     -n NoShadow.\n");
  183. printf("          Don't produce any shadowfile.\n");
  184. printf("     -s Filesize\n");
  185. printf("          The filesize in bytes. Default 730000 bytes.\n");
  186. printf("     -o Outputname\n");
  187. printf("          Name of the outputfiles. \".xxx\" will be appended.\n");
  188. printf("          Default is \"Part\".\n");
  189. printf("\n");
  190. exit(1);
  191. }
  192.  
  193. void usage(void)
  194. {
  195. printf("\n");
  196. printf("Sploiner                 USER COMMANDS                   Sploiner\n");
  197. printf("\n");
  198. printf("\n");
  199. printf("NAME\n");
  200. printf("     %s - Split, Join & Repair.\n",&(Version[6]));
  201. printf("     Splits large files into smaller parts for transportation \n");
  202. printf("     on disk. Possibility for error recovery.\n");
  203. printf("\n");
  204. printf("SYNOPSIS\n");
  205. printf("     Sploiner split  <InputFile> [-n] [-s Disksize] [-o Outputname]\n");
  206. printf("\n");
  207. printf("     Sploiner join <basename> as <joined_file>\n");
  208. printf("\n");
  209. printf("     Sploiner repair file_1 file_2 ... file_n as damaged_file\n");
  210. printf("\n");
  211. printf("     Sploiner example\n");
  212. printf("\n");
  213. printf("DISCLAIMER\n");
  214. printf("     I take NO responsibilities for this program.\n");
  215. printf("     Any use is on your own risk.\n");
  216. printf("\n");
  217. printf("DESCRIPTION\n");
  218. printf("     Splits a program op in smaller sizes, recovers a lost file, \n");
  219. printf("     or join files.\n");
  220. printf("\n");
  221. printf("     Type \"Sploiner split\", \"Sploiner join\" or \"Sploiner repair\"\n");
  222. printf("     for detailed description and \"Sploiner example\" for an example.\n");
  223. printf("\n");
  224. printf("AVAILABILITY\n");
  225. printf("     This program is beerware. If you like it, send or give me a\n");
  226. printf("     beer (or beers %%-). You stand a good chance of finding me in:\n");
  227. printf("     TÅGEKAMMERET, Aarhus universitet, Matematisk institut,\n");
  228. printf("     Ny Munkegade 116, 8000 Aarhus C, Denmark.\n");
  229. printf("     This program is copyrighted to: Richard Jørgensen. \n");
  230. printf("     If you make any improvements to the program, please send them\n");
  231. printf("     to me. \n");
  232. printf("     My address: Internet: ric@daimi.aau.dk\n");
  233. printf("                 Fidonet: 2:238/28.1\n");
  234. printf("                 WWW: http://www.daimi.aau.dk/~ric\n");
  235. printf("                      (Check out the sploiner WWW-page)\n");
  236. printf("                 Real World(tm): Gudrunsvej 48 6th\n");
  237. printf("                                 8220 Brabrand\n");
  238. printf("                                 Denmark\n");
  239. printf("\n");
  240. printf("OPTIONS\n");
  241. printf("     split <file> [-n] [-s <size>] [-o <name>]\n");
  242. printf("          Split a file.\n");
  243. printf("\n");
  244. printf("     join <basename> as <file>\n");
  245. printf("          Join <basename>.nnn and save as <file>\n");
  246. printf("\n");
  247. printf("     repair <files> as <file>\n");
  248. printf("          Cast spell to summon a lost file.\n");
  249. printf("\n");
  250. printf("     example\n");
  251. printf("          Gives a detailed example of sploiner usage.\n");
  252. printf("\n");
  253. printf("SEE ALSO\n");
  254. printf("     split(1), cat(1)\n");
  255. printf("\n");
  256. printf("BUGS\n");
  257. printf("     Some functionality discovered.  :-)\n");
  258. printf("\n");
  259. printf("     Please reports bugs to: ric@daimi.aau.dk (Internet).\n");
  260. printf("\n");
  261.  
  262. exit(1);
  263. }
  264.